package com.lzp.controller;

import com.lzp.utils.JSONResult;
import com.lzp.utils.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 第一个Controller
 * @author: lzp
 * @createTime: 2021-07-25 00:07
 **/
@RestController()
public class HelloController {

    @Autowired
    private Resource resource;

    @GetMapping("/hello")
    public Object hello() {
        return "hello springboot";
    }

    @GetMapping("/getResource")
    public JSONResult getResource() {
        Resource bean = new Resource();
        BeanUtils.copyProperties(resource, bean);
        return JSONResult.ok(bean);
    }
}
